package linkedlist;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 */
public class Main {

    public static void main(String[] args) {
        MyLinkedList<Integer> linkedList = new MyLinkedList<>();
        System.out.println("==========测试尾插法=========");
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        linkedList.add(4);
        linkedList.display();
        linkedList.clear();

        System.out.println("==========测试头插法=========");
        linkedList.addHead(1);
        linkedList.addHead(2);
        linkedList.addHead(3);
        linkedList.addHead(4);
        linkedList.display();
        System.out.println("在第4个位置处插入99");
        linkedList.insertByIndex(4, 99);
        linkedList.display();
        System.out.println("在第0个位置处插入100");
        linkedList.insertByIndex(0, 100);
        linkedList.display();

        System.out.println("==========测试删除=========");
        System.out.println("删除第一个100：");
        linkedList.remove(100);
        linkedList.display();
        System.out.println("删除第一个99：");
        linkedList.remove(99);
        linkedList.display();
        System.out.println("插入一个4");
        linkedList.add(4);
        linkedList.display();
        System.out.println("删除所有的4");
        linkedList.removeAll(4);
        linkedList.display();
    }
}
